using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChargeState : State
{

    protected D_ChargeState stateData;

    protected bool isPlayerInMinAgroRange;

    protected bool isDectectingLedge;
    protected bool isDectetingWall;
    protected bool isChargeTimeOver;
    protected bool performCloseRangeAction;

    public ChargeState(Entity entity, FiniteStateMachine startMachine, string animBoolName,D_ChargeState stateData) : base(entity, startMachine, animBoolName)
    {
        this.stateData = stateData;
    }

    public override void Enter()
    {
        base.Enter();

        isChargeTimeOver = false;
        Movement.SetVelocityX(stateData.chargeSpeed*Movement.FacingDirection);
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void logicUpdate()
    {
        base.logicUpdate();
        Movement.SetVelocityX(stateData.chargeSpeed * Movement.FacingDirection);
        if (Time.time>+startTime+stateData.chargeTime)
        {
            isChargeTimeOver = true;
        }
    }

    public override void PhysicsUpdate()
    {
        base.PhysicsUpdate();

    }

    public override void DoChecks()
    {
        base.DoChecks();
        isDectectingLedge = CollisionSenses.LedgeVertical;
        isDectetingWall = CollisionSenses.WallFront;
        isPlayerInMinAgroRange = entity.CheckPlayerInMinAgroRange();
        performCloseRangeAction = entity.CheckPlayerInCloseRangeAction();
    }
}
